
 package com.ami.iusb;
 
 import com.ami.kvm.jviewer.Debug;
 import com.ami.kvm.jviewer.gui.JViewerApp;
 import com.ami.vmedia.VMApp;
 import com.ami.vmedia.gui.DeviceControlPanel;
 import com.ami.vmedia.gui.VMPane;
 
 public class vFlpyMonitorThread extends Thread
 {
   private FloppyRedir floppyRedir = null;
   private String[] floppyList = null;
   private String floppySource = null;
   private boolean floppyThreadStatus = false;
   private boolean isMediaMatched = false;
   private int fddevice_no = 0;
   
   public vFlpyMonitorThread(int paramInt) {
     this.fddevice_no = paramInt;
   }
   
 
 
 
 
   public void startFloppyMonitor()
   {
     this.floppyThreadStatus = true;
     start();
   }
   
 
 
 
 
   public void startHarddiskMonitor()
   {
     this.floppyThreadStatus = false;
   }
   
 
 
 
   public void run()
   {
     this.floppyRedir = new FloppyRedir(true);
     this.floppySource = VMApp.getInstance().getIUSBRedirSession().getFloppySource(this.fddevice_no);
     
     while (this.floppyThreadStatus)
     {
 
       try
       {
 
         if (!VMApp.getInstance().isFDRedirRunning(this.fddevice_no)) {
           break;
         }
         this.floppyList = this.floppyRedir.getFloppyList();
         
         if (this.floppyList == null) {
           VMApp.getInstance().getIUSBRedirSession().StopFloppyRedir(this.fddevice_no, 3);
           VMApp.getVMPane().getDeviceControlPanel(1, this.fddevice_no).updateDeviceControlPanel();
         }
         else {
           for (int i = 0; i < this.floppyList.length; i++)
           {
             if (this.floppySource.equals(this.floppyList[i])) {
               this.isMediaMatched = true;
               break;
             }
           }
           
 
 
           if (!this.isMediaMatched) {
             VMApp.getInstance().getIUSBRedirSession().StopFloppyRedir(this.fddevice_no, 3);
             VMApp.getVMPane().getDeviceControlPanel(1, this.fddevice_no).updateDeviceControlPanel();
           }
           else {
             this.isMediaMatched = false;
           }
         }
         
         sleep(2000L);
       }
       catch (InterruptedException localInterruptedException)
       {
         stopFloppyAbnormal();
         Debug.out.println(localInterruptedException);
       }
       catch (Exception localException) {
         stopFloppyAbnormal();
         Debug.out.println(localException);
       }
     }
   }
   
 
 
 
 
   private void stopFloppyAbnormal()
   {
     if ((!com.ami.kvm.jviewer.JViewer.isVMApp()) && 
       (JViewerApp.getInstance().getVMDialog() != null)) {
       JViewerApp.getInstance().getVMDialog().setVisible(false);
     }
     VMApp.getInstance().getIUSBRedirSession().stopFloppyAbnormal(this.fddevice_no);
   }
 }


/* Location:              D:\Users\tianlin\Downloads\JViewer.jar!\com\ami\iusb\vFlpyMonitorThread.class
 * Java compiler version: 5 (49.0)
 * JD-Core Version:       0.7.1
 */